import Vue from 'vue';
import Router from 'vue-router';

Vue.use(Router);
// meta.level 账户类型 1：普通用户 2：审核用户
export default new Router({
    routes: [
        {
            path: '/login',
            meta: {
                auth: false,
                level: 1,
                title: '登录'
            },
            name: 'login',
            component: resolve => require(['../components/login/index.vue'], resolve)
        },
        {
            path:'/home',
            meta: {
                auth: true,
                level: 1,
                title: '主页'
            },
            name: 'home',
            component: resolve => require(['../components/home/index.vue'], resolve),
            children:[
                {
                    path: '/home/process',
                    meta: {
                        auth: true,
                        level: 1,
                        title: '流程管理'
                    },
                    component: resolve => require(['../components/process/index.vue'], resolve),
                    children:[
                        /*{
                            path: '',
                            meta: {
                                auth: true,
                                level: 1,
                                title: '代办流程'
                            },
                            name:'agency',
                            component: resolve => require(['../components/process/agency.vue'], resolve)
                        },*/
                        {
                            path: '/process/agency',
                            meta: {
                                auth: true,
                                level: 1,
                                title: '代办流程'
                            },
                            name:'agency',
                            component: resolve => require(['../components/process/agency.vue'], resolve)
                        },
                        {
                            path: '/process/already',
                            meta: {
                                auth: true,
                                level: 1,
                                title: '已办流程'
                            },
                            name:'already',
                            component: resolve => require(['../components/process/already.vue'], resolve)
                        },
                        {
                            path: '/process/details/:id',
                            meta: {
                                auth: true,
                                level: 1,
                                title: '详情'
                            },
                            name:'details',
                            component: resolve => require(['../components/details/index.vue'], resolve)
                        },
                    ]
                },
                {
                    path: '/home/issuinglist',
                    meta: {
                        auth: true,
                        level: 1,
                        title: '发币管理'
                    },
                    name: 'issuinglist',
                    component: resolve => require(['../components/issuing/issuinglist.vue'], resolve),
                },
                {
                    path: '/home/applyforissuing',
                    meta: {
                        auth: true,
                        level: 2,
                        title: '申请发币'
                    },
                    name: 'applyforissuing',
                    component: resolve => require(['../components/issuing/applyforissuing.vue'], resolve),
                },
            ]
        },




        {
            path: '*',
            redirect: {name:'login'}
        }
    ]
})
